home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / Bonus / Plasmatech / ptscp_eval.exe / %MAINDIR% / Interface / UPTFrame.int < prev    next >
Encoding:
Text File  |  2001-08-31  |  6.6 KB  |  194 lines

  1. unit UPTFrame; // Copyright ⌐ 1996-2001 Plasmatech Software Design. All rights reserved.
  2. {
  3.  Shell Control Pack
  4.  Version 1.6
  5.  
  6.  Implements controls that frame a screen region with one of 11 different styles.
  7.  TPTGroup is a windowed control that can be the parent of other controls. It works
  8.  like a group box but with a choice of frame styles. TPTFrame is non-windowed and
  9.  cannot be the parent of other controls - although sibling controls can be placed
  10.  over TPTFrame.
  11.  
  12.  You should choose the control that is most applicable to each situation. If you need
  13.  to contain other controls (as in a groupbox), use TPTGroup. If you are mearly framing
  14.  a screen region then you might use TPTFrame. Being non-windowed TPTFrame uses much
  15.  fewer resources (and no window handles) compared with TPTGroup.
  16.  
  17.  The Draw* functions used to draw the frames are exposed, so you can draw similar
  18.  frames anywhere you want. Many Plasmatools components use these exposed Draw*
  19.  functions to provide embedded frame functionality.
  20.  
  21.  History
  22.  ===================================================================================================
  23.  V1.6   2Jul01 Delphi 6 release, no changes.
  24.  V1.5c 30Mar01 No changes.
  25.  V1.5b 12Dec00 No changes.
  26.  V1.5a 14May00 No changes.
  27.  V1.5   3Mar00 C++Builder 5 support, no changes.
  28.  V1.4a 15Dec99 Published OnContextPopup for Delphi 5.
  29.  V1.4  14Sep99 No changes.
  30.  V1.3h 29Mar99 No changes.
  31.  V1.3g  1Dec98 No changes.
  32.  V1.3f 12Jul98 Added WEAKPACKAGEUNIT directive.
  33.                Added Delphi 4 properties.
  34.                Fixed problem with TabOrder - now published.
  35.  V1.3e 22Apr98 No changes.
  36.  V1.3d 18Apr98 No changes.
  37.  V1.3c 16Mar98 C++Builder 3 support.
  38.                Added DefaultDrawing property and OnPaint event to TPTGroup.
  39.  V1.3b  7Feb98 Added compiler directives.
  40.  V1.3a  7Jan98 Fixed flicker problem with TPTGroup (D3 only) - especially when used
  41.                  in splitter controls.
  42.                The border is now a true non-client area - see WM_NCCALCSIZE and WM_NCPAINT.
  43.                Added TPTCustomGroup.EnableAllChildren method.
  44.  V1.3  28Nov97 No changes.
  45.  V1.2b 12Oct97 No changes.
  46.  V1.2a  5Oct97 No changes.
  47.  V1.2   6Sep97 Removed package warnings.
  48.                Added TPTCustomFrame and TPTCustomGroup base classes.
  49.                Fixed OnClick and OnDblClick properties of TPTFrame and TPTGroup.
  50.  V1.1a  6Jul97 No changes.
  51.  V1.1  26Jun97 No changes.
  52.  V1.0c 31May97 No changes.
  53.  V1.0b 17May97 Delphi 3 support.
  54.  V1.0a  1May97 No changes.
  55.  V1.0  21Apr97 Released version 1.0
  56. }
  57.  
  58. {$INCLUDE PTCompVer.inc}
  59.  
  60. {$RANGECHECKS OFF} {$OVERFLOWCHECKS OFF} {$WRITEABLECONST OFF}
  61. {$BOOLEVAL OFF}    {$EXTENDEDSYNTAX ON}  {$TYPEDADDRESS ON}
  62.  
  63. {$IFDEF VCL30PLUS}
  64.   {$WEAKPACKAGEUNIT}
  65. {$ENDIF}
  66.  
  67. interface
  68. uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
  69.  
  70. type TPTFrameStyle = ( ptfsNone, ptfsGroup, ptfsLowered, ptfsRaised, ptfsDint, ptfsBump,
  71.                        ptfsSingle, ptfsHorzLine, ptfsHorzEdge, ptfsVertLine, ptfsVertEdge );
  72.  
  73.      TPTFramePaintEvent = procedure( aSender: TObject;  aCanvas: TCanvas ) of object;
  74.  
  75.      TPTCustomGroup = class(TCustomControl)
  76.        public
  77.          constructor Create( aOwner: TComponent ); override;
  78.          procedure EnableAllChildren( afEnable: Boolean );
  79.      end; {TPTCustomGroup}
  80.  
  81.  
  82.      TPTGroup = class(TPTCustomGroup)
  83.        published
  84.          property Alignment;
  85.          property DefaultDrawing;
  86.          property FrameSpace;
  87.          property FrameStyle;
  88.        //
  89.          property Align;
  90.          property Caption;
  91.          property Color;
  92.          property Font;
  93.          property Enabled;
  94.          property ParentColor;
  95.          property ParentFont;
  96.          property ParentShowHint;
  97.          property PopupMenu;
  98.          property ShowHint;
  99.          property Visible;
  100.          property Width;
  101.          property Height;
  102.          property TabOrder;
  103.        //
  104.          property OnClick;
  105.          property OnDblClick;
  106.          property OnMouseDown;
  107.          property OnMouseMove;
  108.          property OnMouseUp;
  109.          property OnEnter;
  110.          property OnExit;
  111.          property OnPaint;
  112.  
  113. {$IFDEF VCL40PLUS}
  114.          property Anchors;
  115.          property BiDiMode;
  116.          property BorderWidth;
  117.          property Constraints;
  118.          property ParentBiDiMode;
  119.          property UseDockManager;
  120.          property OnCanResize;
  121.          property OnConstrainedResize;
  122. {$ENDIF}
  123. {$IFDEF VCL50PLUS}
  124.          property OnContextPopup;
  125. {$ENDIF}
  126.      end; {TPTGroup}
  127.  
  128.  
  129.      TPTCustomFrame = class(TGraphicControl)
  130.        public
  131.          constructor Create( aOwner: TComponent ); override;
  132.      end; {TPTCustomFrame}
  133.  
  134.  
  135.      TPTFrame = class(TPTCustomFrame)
  136.        published
  137.          property Alignment;
  138.          property DefaultDrawing;
  139.          property FrameSpace;
  140.          property FrameStyle;
  141.          property OnPaint;
  142.        //
  143.          property Align;
  144.          property Caption;
  145.          property Color;
  146.          property Font;
  147.          property ParentColor;
  148.          property ParentFont;
  149.          property ParentShowHint;
  150.          property PopupMenu;
  151.          property ShowHint;
  152.          property Visible;
  153.          property Width;
  154.          property Height;
  155.        //
  156.          property OnClick;
  157.          property OnDblClick;
  158.          property OnMouseDown;
  159.          property OnMouseMove;
  160.          property OnMouseUp;
  161.  
  162. {$IFDEF VCL40PLUS}
  163.          property Anchors;
  164.          property BiDiMode;
  165.          property Constraints;
  166.          property ParentBiDiMode;
  167.          property OnCanResize;
  168.          property OnConstrainedResize;
  169. {$ENDIF}
  170. {$IFDEF VCL50PLUS}
  171.          property OnContextPopup;
  172. {$ENDIF}
  173.      end;
  174.  
  175.  
  176.  
  177. procedure DrawBumpFrame( c: TCanvas;  const r: TRect );
  178. procedure DrawDintFrame( c: TCanvas;  const r: TRect );
  179. procedure DrawGroupFrame( c: TCanvas;  const ar: TRect;  const caption: String;  color: TColor;  enabled: Boolean );
  180. procedure DrawHorzEdge( c: TCanvas;  const r: TRect;  c1, c2: TColor );
  181. procedure DrawHorzLine( c: TCanvas;  const r: TRect;  c1, c2: TColor );
  182. procedure DrawLoweredFrame( c: TCanvas;  const r: TRect );
  183. procedure DrawRaisedFrame( c: TCanvas;  const r: TRect );
  184. procedure DrawSingleFrame( c: TCanvas;  const r: TRect );
  185. procedure DrawVertEdge( c: TCanvas;  const r: TRect;  c1, c2: TColor );
  186. procedure DrawVertLine( c: TCanvas;  const r: TRect;  c1, c2: TColor );
  187.  
  188. procedure DrawFrame( fs: TPTFrameStyle; c: TCanvas;  const r: TRect );
  189.  
  190. procedure AdjustRectForFrame( fs: TPTFrameStyle;  var r: TRect );
  191.  
  192. {*********************************************************}
  193. implementation
  194.